package com.web44.spring.mapper.impl;

import com.web44.spring.mapper.IUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

/**
 * @Title: UserMapper
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/1/10 14:56
 */
@Repository
public class UserMapper implements IUserMapper {

    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Override
    public void updateBalance(int userId, double balance) {
        String sql = "update t_user set balance = balance - ?  where user_id = ?";
        jdbcTemplate.update(sql,balance,userId);

    }
}
